package jk.fox.engine.context;

import jk.fox.common.payload.container.RpcContainer;
import jk.fox.invocation.Invocation;
import jk.fox.invocation.RpcInvocation;
import jk.fox.invocation.invoker.Invoker;
import jk.fox.invocation.invoker.RpcInvoker;
import jk.fox.invocation.proxy.JdkProxyFactory;
import jk.fox.invocation.proxy.ProxyFactory;

/**
 * @author cuichao
 * @Description: AbstractInvocationRpcContext
 * @Date: create in 2020/6/1 0:00
 */
public abstract class AbstractInvocationRpcContext implements RpcContext {
    /**
     *Rpc节点容器
     */
    protected RpcContainer container;
    /**
     *Rpc调用执行器
     */
    protected Invocation invocation;
    /**
     *Rpc消费代理工厂
     */
    protected ProxyFactory proxyFactory;
    /**
     *Rpc服务执行器
     */
    protected Invoker invoker;

    public AbstractInvocationRpcContext(RpcContainer container){
        this.container = container;
        this.proxyFactory = new JdkProxyFactory();
        this.invoker = new RpcInvoker();
        invocation = new RpcInvocation(invoker,proxyFactory,container);
    }


    public Invocation invocation(){
        return this.invocation;
    }


}
